package com.example.Service.impl;

import com.example.Service.LogRepository;
import com.example.pojo.LogEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

@Service
public class LogService {

    @Autowired
    private LogRepository logRepository;

    public void log(String logLevel, String logger, String message) {
        LogEntity logEntity = new LogEntity();
        logEntity.setLogTime(LocalDateTime.now());
        logEntity.setLogLevel(logLevel);
        logEntity.setLogger(logger);
        logEntity.setMessage(message);
        logRepository.save(logEntity);
    }

}
